﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;

namespace BanHangCshap.Class.gkhtdl63.DAL
{
    public abstract class Khachhang2DAL : clsBaseDAL
    {
        public DataTable Khachhang2_Laydanhsach(int Loai)
        {
            string xlSPName = "sp_Khachhang2_Laydanhsach";
            string[] xlSPPara = { "@Loai" };
            object[] xlSPValu = { Loai };
            return base.Select(xlSPName, xlSPPara, xlSPValu);
        }
        //sp_Khachhang2_Laydanhsach_View
        public DataTable Khachhang2_Laydanhsach_View(int Loai)
        {
            //return base.Select("sp_Khachhang2_Laydanhsach_View");

            string xlSPName = "sp_Khachhang2_Laydanhsach_View";
            string[] xlSPPara = { "@Loai" };
            object[] xlSPValu = { Loai };
            return base.Select(xlSPName, xlSPPara, xlSPValu);

        }

        public DataTable Khachhang2_Laydanhsach_View()
        {
            return base.Select("sp_Khachhang2_Laydanhsach_ViewNoPara");
        }

        public DataTable Khachhang2_Laytheoma(string Ma)
        {
            string xlSPName = "sp_Khachhang2_Laytheoma";
            string[] xlSPPara = {"@Ma" };
            object[] xlSPValu = { Ma };
            return base.Select(xlSPName, xlSPPara, xlSPValu);
        }

        public DataTable Khachhang2_Them(DAL.Entities.Khachhang2 xlKH2)
        {
            string xlSPName = "sp_Khachhang2_Them";
            string[] xlSPPara = {   "@Ma"
                                    ,"@Ten"
                                    ,"@Diachi"
                                    ,"@SoDienthoai"
                                    ,"@CongnoBandau"
                                    ,"@Ma_Nhom"
                                    ,"@Ghichu"
                                    ,"@Fax"
                                    ,"@Email"
                                    ,"@Taikhoan"
                                    ,"@Thue"
                                    ,"Loai"
                                };

            object[] xlSPValu = {xlKH2.Ma
                                ,xlKH2.Ten
                                ,xlKH2.Diachi
                                ,xlKH2.SoDienthoai
                                ,xlKH2.CongnoBandau
                                ,xlKH2.Ma_Nhom
                                ,xlKH2.Ghichu
                                ,xlKH2.Fax
                                ,xlKH2.Email
                                ,xlKH2.Taikhoan
                                ,xlKH2.Thue
                                ,xlKH2.Loai
                                 };
            return base.InsertReturnObj(xlSPName, xlSPPara, xlSPValu);
        }

        public bool Khachang2_Capnhat(DAL.Entities.Khachhang2 xlKH2)
        {
            string xlSPName = "sp_Khachhang2_Capnhat";
            string[] xlSPPara = {"@Id"
                                ,"@Ma"
                                ,"@Ten"
                                ,"@Diachi"
                                ,"@SoDienthoai"
                                ,"@CongnoBandau"
                                ,"@Ma_Nhom"
                                ,"@Ghichu"
                                ,"@Fax"
                                ,"@Email"
                                ,"@Taikhoan"
                                ,"@Thue"
                                };

            object[] xlSPValu = {xlKH2.Id
                                ,xlKH2.Ma
                                ,xlKH2.Ten
                                ,xlKH2.Diachi
                                ,xlKH2.SoDienthoai
                                ,xlKH2.CongnoBandau
                                ,xlKH2.Ma_Nhom
                                ,xlKH2.Ghichu
                                ,xlKH2.Fax
                                ,xlKH2.Email
                                ,xlKH2.Taikhoan
                                ,xlKH2.Thue
                                };
            return base.Update(xlSPName, xlSPPara, xlSPValu);
        }

        public bool Khachhang2_Xoa(long Id)
        {
            string xlSPName = "sp_Khachang2_Xoa";
            string[] xlSPPara = {"@Id"};
            object[] xlSPValu = {Id};
            return base.Update(xlSPName, xlSPPara, xlSPValu);
        }
    }
}
